#include "titleStatus.h"
#include "pauseStatus.h"
#include "playMode.h"


CTitleStatus::CTitleStatus( CPlayMode* modePlay )
	:CStatus(modePlay),nSelect(0),nCount(2)
{
	wsprintf(m_szMenu[0],L"START");
	wsprintf(m_szMenu[1],L"EXIT");
}


VOID CTitleStatus::DisposeInput()
{

	CInput* input=m_modePlay->m_input;
	CSound* sound=m_modePlay->m_sound;

	input->ReadKeyboard();
	
	
	if( input->IsDownKeyRelease() )
	{
		if( nSelect<=nCount-2 )
		{
			sound->Select();
			nSelect++;
		}
		else
		{
			sound->Hurt();
		}
	}
	if( input->IsUpKeyRelease() )
	{
		if( nSelect>=1 )
		{
			sound->Select();
			nSelect--;
		}
		else
		{
			sound->Hurt();
		}
	}

	if( input->IsSpaceKeyDown() )
	{
		if( 0==nSelect )
		{
			m_modePlay->Restart();
		}
		else if( 1==nSelect )
		{
			m_modePlay->Exit();
		}
		
		sound->Select();
	}

}


VOID CTitleStatus::DisposeGame()
{

}


VOID CTitleStatus::Draw()
{
	
	std::list<CObject*>::iterator iter;


	RECT rect={450,500,800,700};
	RECT rectTitle={370,350,800,700};
	m_modePlay->m_draw->BeginDraw();


	for( int i=0 ; i<nCount ; i++ )
	{
		rect.top+=25;
		rect.left+=12;
		D3DCOLOR color;
		if( i==nSelect )
		{
			color=D3DCOLOR_ARGB( 255,255,255,0 );
		}
		else
		{
			color=D3DCOLOR_ARGB( 255,255,0,0 );
		}
		m_modePlay->m_font->DrawText( NULL,m_szMenu[i],-1,&rect,DT_TOP|DT_LEFT,color );
	}
	m_modePlay->m_bigFont->DrawText( NULL,L"Biu~Biu~Biu~",-1,&rectTitle,DT_TOP|DT_LEFT,D3DCOLOR_ARGB( 255,255,0,0 ) );

	m_modePlay->m_draw->EndDraw();
}
